package com.tgb.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

/**
 * Entity: 请假实体
 *
 * @author hejingyuan IdEntity implements Serializable
 */
@Entity
@Table(name = "Applyleave")
public class Leave implements Serializable {  

	private static final long serialVersionUID = 1L;
		
	private Long id;
	//请假人
	private String userId;
	//请假原因
	private String reason;

	// -- 临时属性 --//
	private Map<String, Object> variables;	
	//请假类型
	private String leaveType;
	//办理结果-对应的办理记录信息
	private Set<Approve> approves;
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="leave")
	public Set<Approve> getApproves() {
		return approves;
	}

	public void setApproves(Set<Approve> approves) {
		this.approves = approves;
	}

	@Id
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	
	//开始时间
	private String startTime;

	//结束时间
	private String endTime;

	@Column
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	
	
	@Column(name = "START_TIME")
	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	
	@Column(name = "END_TIME")
	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	

	@Column
	public String getLeaveType() {
		return leaveType;
	}

	public void setLeaveType(String leaveType) {
		this.leaveType = leaveType;
	}

	@Column
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	@Transient
	public Map<String, Object> getVariables() {
		return variables;
	}

	public void setVariables(Map<String, Object> variables) {
		this.variables = variables;
	}
	
	
}
